<template>
  <div>
    <!-- 旅游景区分类统计情况 -->
    <Echart :options="options" id="total-chart" height="240px" width="100%">
    </Echart>
  </div>
</template>

<script>
import Echart from "@/common/echart";
export default {
  data() {
    return {
      options: {},
    };
  },
  components: {
    Echart,
  },
  props: {
    cdata: {
      type: Object,
      default: () => ({}),
    },
  },
  watch: {
    cdata: {
      handler(newData) {
        this.options = {
          color: [
            "#32c5e9",
            "#9fe6b8",
            "#91cc75",
            "#ffdb5c",
            "#ff9f7f",
            "#FA8072",
            "#fb7293",
            "#e7bcf3",
            "#8378ea",
            "#AB82FF",
          ],
          tooltip: {
            trigger: "item",
            formatter: " {b} : {c} ({d}%)",
            borderColor: "#8C8D8E",
          },
          legend: {
            left: "4%",
            top: "bottom",
            icon: "circle",
            x: "center",
            data: newData.category,
          },
          grid: {
            top: "8%",
            left: "12%",
          },
          series: [
            {
              name: "旅游景区分类统计情况",
              type: "pie",
              radius: [10, 120],
              center: ["50%", "50%"],
              roseType: "area",
              itemStyle: {
                borderRadius: 8,
              },
              label: {
                show: false,
              },
              data: newData.sceneryData,
            },
          ],
        };
      },
      immediate: true,
      deep: true,
    },
  },
};
</script>

<style>
</style>